home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / serien / purity / nr.10 / medplayerlibrary / medplay1.0b.p < prev    next >
Text File  |  1995-04-19  |  2KB  |  75 lines

  1. program medplay;
  2.  
  3. *  Medplay.p ,  1993 by Diesel,  (P)1993 in the  Pascal-FD-Serie  *
  4.   *  "Purity". Feel free 2 spread this !  [ This version 1.0b is    *
  5.   *  only 4 use in CLI. ]                       Bernd K., 1993      * }
  6.  
  7.  
  8. *  This example uses the medplayer.library . Compiled with PCQ-   *
  9.   *  Pascal V1.2 .                                                  * }
  10.  
  11.  
  12. {$I "Include:Libraries/medplayer.i"    }
  13. {$I "Include:libraries/dos.i"        }
  14. {$I "Include:exec/Libraries.i"        }
  15. {$I "Include:utils/Parameters.i"    }
  16. {$I "Include:Diesel/LMB.i"        }
  17.  
  18.  
  19. VAR
  20.     buf    : Array[0..99] of Char;
  21.     name    : String;
  22.     module    : MMD0Ptr;        { * Ptr auf einen Medsong-Record * }
  23.  
  24.  
  25.  
  26. * Zum sauberen Verlassen des Programms : * }
  27.  
  28. Procedure CleanExit( why : String; rt : Integer);
  29. BEGIN
  30.       { * Song adios * }
  31.     IF module <> NIL THEN UnloadModule( module );
  32.       { * Library zu * }
  33.     IF MEDPlayerBase <> NIL THEN CloseLibrary( MEDPlayerBase );
  34.       { * ggf. Msg ausgeben * }
  35.     IF why <> NIL THEN write( why );
  36.       { * Bye ! * }
  37.     Exit( rt );
  38. END;
  39.  
  40.  
  41.  
  42. BEGIN
  43.     name := Adr( buf );        { * CLI-Parameter holen * }
  44.     GetParam( 1, name );
  45.     IF buf[0] = chr(0) THEN        { * Kein Parameter ? -> Bye ! * }
  46.       CleanExit("Medplay 1.0b, 1993 by Diesel\nUsage: Medplay med-modulename\n\n",0);
  47.  
  48.                     { * Library aufmachen, logo * }
  49.     MEDPlayerBase := OpenLibrary( medname, 0 );
  50.     IF MEDPlayerBase = NIL THEN
  51.       CleanExit("Cannot open medplayer.library\n", 10);
  52.  
  53.  
  54.     IF GetPlayer(0) = 0  THEN BEGIN        { * Player installieren * }
  55.  
  56.       module := LoadModule( name );        { * Song laden * }
  57.       IF module = NIL THEN
  58.         CleanExit("Cannot load module\n",0);
  59.  
  60.       write("Module address = ", Integer(module), "\n\n" );
  61.       PlayModule(module);            { * Sound an - yeah ! * }
  62.  
  63.       write("Press left MB...\n");
  64.       repeat                { * Auf linke Maus- * }
  65.         Delay(10);                { * taste warten    * }
  66.       Until LeftMouseButton;
  67.  
  68.       FreePlayer;                { * Player adios   * }
  69.  
  70.     END ELSE       CleanExit("Cannot init player\n",0);
  71.  
  72.     CleanExit( NIL, 0 );
  73. END.
  74.  
  75.